using UnityEngine;

public class Flame : MonoBehaviour
{
    private const float IntensityPerParticle = 0.015f;
    private ParticleSystem m_particleSystem;
    private MyLight2D myLight2D;

    private void Awake()
    {
        m_particleSystem = GetComponent<ParticleSystem>();
        myLight2D = GetComponentInChildren<MyLight2D>();
    }

    private void FixedUpdate()
    {
        UpdateIntensity();
    }

    private void UpdateIntensity()
    {
        myLight2D.Ls = IntensityPerParticle * m_particleSystem.particleCount;
    }
}
